home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
007a
/
pophits.zip
/
POPHITS.BAS
< prev
next >
Wrap
BASIC Source File
|
1988-09-14
|
11KB
|
362 lines
DEFINT A-Y
CONST false = 0, true = NOT false
DECLARE SUB Painter ()
DECLARE SUB TopOfPage (counts%, counta%, serch$)
DECLARE SUB PrintLine (dat$, weeks%, title$, artist$, sinalb$, catgry$, counts%, counta%)
DECLARE SUB EndOfPage (counts%, counta%)
DECLARE FUNCTION IntIn% (y%, X%, mn%, mx%, length%)
DECLARE FUNCTION OneInt% (y%, x%, mn%, mx%)
DIM SHARED m$(10), np, ch, yn$
DECLARE SUB center (whichline AS INTEGER, tl$)
DECLARE SUB pulldwn1 (choice$(), choicenum!, leftmarg!, boxwid!)
choicemax = 5 'The max. number of choices in this example
leftmarg! = 20 'The left margin of the window
boxwid! = 34 'The desired width of the window
DIM choice$(choicemax) 'choicemax=max number of choices
choice$(1) = "Search Database for Artist"
choice$(2) = "Search Database for Title"
choice$(3) = "Show Hits by Year"
choice$(4) = "Show Hits by Weeks at #1"
choice$(5) = "Quit to DOS"
start:
CALL Painter
getkey:
CALL pulldwn1(choice$(), choicenum!, leftmarg!, boxwid!)
'The command, CALL, could be omitted if the sub is declared as above
'Now, in this case, we display the choice selected. It would
'normally be used in the main program.
ON choicenum! GOTO arts, tits, year, week, quit
GOTO start
arts:
RESET
OPEN "pophits.del" FOR INPUT AS #1
COLOR 15, 4
LOCATE 18, 16
PRINT "█ █▓▓"
LOCATE 19, 16
PRINT "█ Enter a string for 'Artist' search: █▓▓"
LOCATE 20, 16
PRINT "█ █▓▓"
LOCATE 21, 16
PRINT "█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▓▓"
LOCATE 22, 18
PRINT "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"
COLOR 14, 1
LOCATE 20, 22
INPUT "", artin$
IF artin$ = "" THEN
GOTO start
END IF
uartin$ = UCASE$(artin$)
serch$ = "Searching for " + uartin$
CALL TopOfPage(counts, counta, serch$)
DO WHILE NOT EOF(1)
INPUT #1, dat$, weeks, title$, artist$, sinalb$, catgry$
uartist$ = UCASE$(artist$)
IF INSTR(uartist$, uartin$) THEN
CALL PrintLine(dat$, weeks, title$, artist$, sinalb$, catgry$, counts, counta)
END IF
LOOP
CALL EndOfPage(counts, counta)
GOTO start
tits:
RESET
OPEN "pophits.del" FOR INPUT AS #1
COLOR 15, 4
LOCATE 18, 16
PRINT "█ █▓▓"
LOCATE 19, 16
PRINT "█ Enter a string for 'Title' search: █▓▓"
LOCATE 20, 16
PRINT "█ █▓▓"
LOCATE 21, 16
PRINT "█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▓▓"
LOCATE 22, 18
PRINT "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"
COLOR 14, 1
LOCATE 20, 22
INPUT "", titin$
IF titin$ = "" THEN
GOTO start
END IF
utitin$ = UCASE$(titin$)
serch$ = "Searching for " + utitin$
CALL TopOfPage(counts, counta, serch$)
DO WHILE NOT EOF(1)
INPUT #1, dat$, weeks, title$, artist$, sinalb$, catgry$
utitle$ = UCASE$(title$)
IF INSTR(utitle$, utitin$) THEN
CALL PrintLine(dat$, weeks, title$, artist$, sinalb$, catgry$, counts, counta)
END IF
LOOP
CALL EndOfPage(counts, counta)
GOTO start
year:
RESET
OPEN "pophits.del" FOR INPUT AS #1
COLOR 15, 4
LOCATE 18, 16
PRINT "█ █▓▓"
LOCATE 19, 16
PRINT "█ Enter a year as 'YYYY' or 'YY': █▓▓"
LOCATE 20, 16
PRINT "█ █▓▓"
LOCATE 21, 16
PRINT "█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▓▓"
LOCATE 22, 18
PRINT "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"
COLOR 14, 1
LOCATE 20, 22
INPUT "", yerin$
IF yerin$ = "" THEN
GOTO start
END IF
serch$ = "Searching for " + yerin$
CALL TopOfPage(counts, counta, serch$)
DO WHILE NOT EOF(1)
INPUT #1, dat$, weeks, title$, artist$, sinalb$, catgry$
IF yerin$ = "19" + RIGHT$(dat$, 2) OR yerin$ = RIGHT$(dat$, 2) THEN
CALL PrintLine(dat$, weeks, title$, artist$, sinalb$, catgry$, counts, counta)
END IF
LOOP
CALL EndOfPage(counts, counta)
GOTO start
week:
RESET
OPEN "pophits.del" FOR INPUT AS #1
COLOR 15, 4
LOCATE 18, 16
PRINT "█ █▓▓"
LOCATE 19, 16
PRINT "█ Enter a range between 1 and 99: █▓▓"
LOCATE 20, 16
PRINT "█ █▓▓"
LOCATE 21, 16
PRINT "█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▓▓"
LOCATE 22, 18
PRINT "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"
COLOR 14, 1
y% = 20
X% = 22
mn% = 1
mx% = 99
length% = 2
wekin1% = IntIn%(y%, X%, mn%, mx%, length%)
y% = 20
X% = 28
mn% = wekin1%
mx% = 99
length% = 2
wekin2% = IntIn%(y%, X%, mn%, mx%, length%)
serch$ = "Searching for " + STR$(wekin1%) + " through " + STR$(wekin2%) + " weeks"
CALL TopOfPage(counts, counta, serch$)
DO WHILE NOT EOF(1)
INPUT #1, dat$, weeks, title$, artist$, sinalb$, catgry$
IF wekin1% <= weeks AND wekin2% >= weeks THEN
CALL PrintLine(dat$, weeks, title$, artist$, sinalb$, catgry$, counts, counta)
END IF
LOOP
CALL EndOfPage(counts, counta)
GOTO start
eoread:
PRINT "ABEND QB4 Error has occurred"
quit:
CLS
END
SUB center (whichline, tl$)
'This is a simple routine that centers a string of text TL$
'on line number WHICHLINE. You can use it anywhere.
tl = LEN(tl$)
tl = INT((80 - tl) / 2)
LOCATE whichline, tl
PRINT tl$;
END SUB
SUB EndOfPage (counts, counta)
COLOR 14, 1
PRINT "Albums selected:"; counta; " Singles:"; counts
LOCATE 24, 20
INPUT "* Press Enter to continue *", xxx$
END SUB
FUNCTION IntIn% (y%, X%, mn%, mx%, length%)
DO
COLOR 15, 4
temp$ = ""
LOCATE y%, X%: PRINT STRING$(length%, 176); : LOCATE y%, X%
DO
t$ = INPUT$(1)
IF t$ = CHR$(13) AND temp$ <> "" THEN
IF VAL(temp$) < mn% OR VAL(temp$) > mx% THEN
BEEP: EXIT DO
ELSE
PRINT STRING$(length% - LEN(temp$), 32);
frmt$ = STRING$(length%, "#") + ","
LOCATE y%, X%
PRINT USING frmt$; VAL(temp$);
IntIn% = VAL(temp$)
EXIT FUNCTION
END IF
ELSEIF t$ = CHR$(8) AND temp$ <> "" THEN
temp$ = LEFT$(temp$, LEN(temp$) - 1)
PRINT CHR$(29); CHR$(176); CHR$(29);
ELSEIF LEN(temp$) = length% THEN
BEEP
ELSEIF t$ < "0" OR t$ > "9" THEN
BEEP
ELSE
temp$ = temp$ + t$: PRINT t$;
END IF
LOOP
LOOP
END FUNCTION
SUB Painter
VIEW PRINT 1 TO 25
COLOR 15, 1
CLS
COLOR 15, 0
LOCATE 2, 16
PRINT "█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█"
LOCATE 3, 16
PRINT "█ █▓▓"
LOCATE 4, 16
PRINT "█ Billboard #1 Hits Database █▓▓"
LOCATE 4, 24
COLOR 31, 0
PRINT ""
LOCATE 4, 53
PRINT ""
COLOR 15, 0
LOCATE 5, 16
PRINT "█ █▓▓"
LOCATE 6, 16
PRINT "█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▓▓"
LOCATE 7, 18
PRINT "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"
COLOR 15, 4
LOCATE 10, 16
PRINT "█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ Menu ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█"
LOCATE 11, 16
PRINT "█ █▓▓"
LOCATE 12, 16
PRINT "█ █▓▓"
LOCATE 13, 16
PRINT "█ █▓▓"
LOCATE 14, 16
PRINT "█ █▓▓"
LOCATE 15, 16
PRINT "█ █▓▓"
LOCATE 16, 16
PRINT "█ █▓▓"
LOCATE 17, 16
PRINT "█ █▓▓"
LOCATE 18, 16
PRINT "█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▓▓"
LOCATE 19, 18
PRINT "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"
COLOR 14, 1
END SUB
SUB PrintLine (dat$, weeks, title$, artist$, sinalb$, catgry$, counts, counta)
IF sinalb$ = "a" THEN
COLOR 15, 1
type$ = "Album"
counta = counta + 1
END IF
IF sinalb$ = "s" THEN
COLOR 11, 1
type$ = "Single"
counts = counts + 1
END IF
PRINT type$; TAB(8);
PRINT USING "##"; weeks,
PRINT TAB(11); artist$; TAB(31); title$; TAB(71); dat$
IF CSRLIN >= 23 THEN
COLOR 14, 1
LOCATE 24, 20
INPUT "* Press Enter to continue *", xxx$
CLS
END IF
END SUB
SUB TopOfPage (counts, counta, serch$)
counta = 0
counts = 0
COLOR 14, 1
CLS
PRINT serch$
PRINT "Type Weeks Artist Title Date"
VIEW PRINT 3 TO 25
END SUB
' (c) 1987 by Paul M. Friedman
FUNCTION OneInt% (y%, x%, mn%, mx%)
temp$ = ""
WHILE temp$ = "" OR VAL(temp$) < mn% OR VAL(temp$) > mx%
temp$ = INPUT$(1)
IF temp$ < "0" OR temp$ > "9" THEN
BEEP: temp$ = ""
ELSEIF VAL(temp$) < mn% OR VAL(temp$) > mx% THEN
BEEP: temp$ = ""
END IF
OneInt% = VAL(temp$)
WEND
END FUNCTION
SUB pulldwn1 (choice$(), choicenum!, leftmarg!, boxwid!) STATIC
' This procedure will return the selected choice number as choicenum
numchoice = UBOUND(choice$) 'this array should have been dimensioned
'to max number of choices
'Draw a box
'initial screen
LOCATE 12, (leftmarg! + 5): COLOR 4, 7: PRINT "1 " + choice$(1): COLOR 15,4
FOR n = 1 TO (numchoice - 1)
LOCATE (12 + n), (leftmarg! + 5)
PRINT CHR$(49 + n) + " " + choice$(n + 1)
NEXT n
DO
WHILE g = 0
x$ = INKEY$
IF x$ <> "" THEN g = 1
WEND: g = 0
IF LEN(x$) = 2 THEN x$ = RIGHT$(x$, 1): mark = 1 'extended code
IF mark AND ASC(x$) = 72 AND down > 0 THEN down = down - 1: mark = 0
IF mark AND ASC(x$) = 72 AND down = 0 THEN down = numchoice - 1: mark = 0
IF mark AND ASC(x$) = 80 AND down < (numchoice - 1) THEN down = down + 1: mark = 0
IF mark AND ASC(x$) = 80 AND down = (numchoice - 1) THEN down = 0: mark = 0
FOR n = 0 TO (numchoice - 1)
IF down = n THEN
LOCATE (12 + n), (leftmarg! + 5): COLOR 4,7
PRINT CHR$(49 + n) + " " + choice$(n + 1): COLOR 15,4
ELSE
LOCATE (12 + n), (leftmarg! + 5)
PRINT CHR$(49 + n) + " " + choice$(n + 1)
END IF
NEXT n
FOR n = 1 TO numchoice
IF x$ = CHR$(48 + n) THEN down = n - 1: x$ = CHR$(13)
NEXT n
LOOP WHILE x$ <> CHR$(13)
choicenum! = down + 1: down = 0
END SUB